<?php
/**
 * Created by PhpStorm.
 * User: lixy
 * Date: 2016/1/6
 * Time: 9:14
 */


use yii\helpers\Url;
use app\lib\WeixinUtils;

$imgUrl = Url::to("@web/img/wx/");
$jsUrl = Url::to("@web/js/wx/");
$basejsUrl = Url::to("@web/js/");
$cssUrl = Url::to("@web/css/wx/");
//获取微信js
$sign= WeixinUtils::getJs_SignPackage();
?>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>送礼记录详情</title>
    <link rel="stylesheet" href="<?= $cssUrl ?>receive_goods.css"/>
    <link rel="stylesheet" href="<?= $cssUrl ?>weui.css"/>
    <script type="text/javascript" src="<?= $basejsUrl ?>jquery.js"></script>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
    <script src="<?= $jsUrl ?>zepto.min.js"></script>

    <script>
        function href_card_list(id){
            //alert(id);
            id=encodeURI(id);
            window.location.href="<?=Url::to(["wx-biz/card-detail"]);?>?isbuy=0&id="+id;
        }
        $(function($){

        });
        wx.config({
            debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
            appId: '<?=APPID?>', // 必填，公众号的唯一标识
            timestamp:<?=$sign['timestamp']?> , // 必填，生成签名的时间戳
            nonceStr: '<?=$sign['nonceStr']?>', // 必填，生成签名的随机串
            signature: '<?=$sign['signature']?>',// 必填，签名，见附录1
            jsApiList: ['onMenuShareAppMessage'] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
        });
        wx.ready(function(){
            var orderid=$("#hidden_orderid").val();
            var url=$("#hidden_url").val()+"?id="+orderid;

            //分享给朋友
            wx.onMenuShareAppMessage({
                title: '<?=$user['NICK_NAME']?>免费送你朵拉礼卡', // 分享标题
                desc: '点击兑换朵拉魔盒好礼！朵拉超越你的想象，精彩好礼随心兑换！送心意、送逼格！送礼就选朵拉盒 ', // 分享描述+orderid
                link: url, // 分享链接  receive-gift
                imgUrl: 'http://wx.duolahe.com/biz_weixin/web/logo.jpg', // 分享图标
                type: 'link', // 分享类型,music、video或link，不填默认为link
                dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
                success: function () {
                    // 用户确认分享后执行的回调函数
                },
                cancel: function () {
                    // 用户取消分享后执行的回调函数
                }
            });
        });
    </script>
</head>

<body>
<input type="hidden" id="hidden_orderid" value="<?=$orderid?>"/>
<input type="hidden" id="hidden_url" value="<?=Url::to(["wx-biz/get-card"],true)?>"/>
<div class="main">
    <div class="top_bg">
        <div class="top_img">
            <div class="top_1">
                <div class="text"><?=$card['VALID_DATE_MESSAGE']?></div>
                <div class="number" style="display: none;"><?=$card['PRICE']?></div>
                <div class="price" style="display: none;">¥</div>
            </div>
            <div class="msg"><?=$card['NAME']?></div>
            <div class="but" onclick="href_card_list('<?=$card["ID"]?>');">查看礼品卡详情</div>
        </div>
    </div>

    <div class="center">
        <div class="center-1">
            <label class="center_text"><?=$card['BUYTIME']?></label><label class="center_text1">送出<?=$count?>张</label>
        </div>
        <div class="center-2">
            <label class="center_text">已被</label>
            <label class="center_text1">领取<?=$getcount?>张</label>
            <label class="center_text">，</label>
            <label class="center_text1">剩余<?=$count-$getcount?>张</label>
            <label class="center_text">未被领取</label>
        </div>
        <img style="width:320px;" src="<?= $imgUrl ?>receive_gift_img/hr_a.png"/>
    </div>

    <div class="down">
        <?php

        foreach ($rCards as &$rCard) {
            ?>
            <div class="list">
                <div class="list-content">
                    <img class="list_head" src="<?=$rCard['HEADER_URL']?>" style="width:40px; float: left;"/>
                    <div class="list_name"><?=$rCard['NICK_NAME']?></div>
                    <div class="list_msg">已领取</div>
                    <div class="list_date"><?=$rCard['CREATE_DATETIME']?></div>
                </div>
                <hr style="border:1px #534431 dashed; width:300px;"/>
            </div>

            <?php
        }
        ?>
    </div>
</div>
</body>
</html>

